package com.weixiaodong.javabasic.Java注解.自定义注解案例1;

import com.weixiaodong.javabasic.Java注解.自定义注解案例1.annotation.Length;
import com.weixiaodong.javabasic.Java注解.自定义注解案例1.annotation.NotEmpty;
import com.weixiaodong.javabasic.Java注解.自定义注解案例1.annotation.NotNull;

import java.util.HashMap;

public class Student {

    @NotNull(message = "Student类中的name字段不能为null")
    @NotEmpty(message = "Student类中的name字段不能为空字符串")
    private String name; // 学生姓名

    @NotNull(message = "Student类中的sno字段不能为null")
    @NotEmpty(message = "Student类中的sno字段不能为空字符串")
    private String sno;  // 学号

    @NotNull(message = "Student类中的card字段不能为null")
    @NotEmpty(message = "Student类中的card字段不能为空字符串")
    @Length(min = 7, max = 7, message = "Student类中的card字段的长度异常")
    private String card; // 学生证号

    private HashMap<SubjectEnum, Float> scoreMap; // key: subject   value: score

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSno() {
        return sno;
    }

    public void setSno(String sno) {
        this.sno = sno;
    }

    public HashMap<SubjectEnum, Float> getScoreMap() {
        return scoreMap;
    }

    public void setScoreMap(HashMap<SubjectEnum, Float> scoreMap) {
        this.scoreMap = scoreMap;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", sno='" + sno + '\'' +
                ", card='" + card + '\'' +
                ", scoreMap=" + scoreMap +
                '}';
    }
}
